import { ZwUnityKitPayHubNetwork } from '@zhongwan/zw-unitykit-network';
// const baseUrl = 'https://payhub-api-dev.keyid.cn';
import { getUrl } from '../utils/index';

/**
 * @description: 文件上传参数申请接口
 * @param {*} data
 * @return {*}
 */
export const applyUploadParam = (app, data) => {
    // const url = `${baseUrl}/payhub-api/storage-private/apply-upload-param`;
    const url = getUrl(app, '/payhub-api/storage-private/apply-upload-param');
    const method = 'post';
    return ZwUnityKitPayHubNetwork({ url, method }, data);
};

/**
 * @description: 阿里云OSS直穿后的回调接口
 * @param {*} data
 * @return {*}
 */
export const uploadImageToOss = (url, data) => {
    // const url = 'https://payhub.static-keyid.cn';
    const method = 'post';
    const headers = { 'Content-Type': 'multipart/form-data' };
    return ZwUnityKitPayHubNetwork({ url, method, headers }, data);
};

/**
 * @description: OCR识别
 * @param {*} data
 * @return {*}
 */
export const getOcrInfo = (app, data) => {
    // const url = `${baseUrl}/payhub-api/storage-private/file-ocr`;
    const url = getUrl(app, '/payhub-api/storage-private/file-ocr');
    const method = 'post';
    return ZwUnityKitPayHubNetwork({ url, method }, data);
};

/**
 * @description: 地址信息识别
 * @param {*} data
 * @return {*}
 */
export const resolveAddress = (app, data) => {
    // const url = `${baseUrl}/payhub-api/storage-private/address-resolve`;
    const url = getUrl(app, '/payhub-api/storage-private/address-resolve');
    const method = 'post';
    return ZwUnityKitPayHubNetwork({ url, method }, data);
};
